package dk.isten.andro.main;


import android.app.Activity;
import android.content.Intent;
import dk.isten.andro.R;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

public class SpillerProfil_Akt extends SuperActivity implements OnClickListener{
    /** Called when the activity is first created. */
	

	ImageView roed, horn,gul, spiller_img, imageView1;
	TextView spillerprofil;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle extras = getIntent().getExtras();
        setContentView(R.layout.spillerprofil);
        

        gul = (ImageView) findViewById(R.id.yellow);
        horn = (ImageView) findViewById(R.id.horn);
        roed = (ImageView) findViewById(R.id.red);
        imageView1 = (ImageView) findViewById(R.id.imageView1);
		
		imageView1.setOnClickListener(this);
        gul.setOnClickListener(this);
        horn.setOnClickListener(this);
        roed.setOnClickListener(this);
        
        spillerprofil = (TextView) findViewById(R.id.spillerprofil);
        spiller_img = (ImageView) findViewById(R.id.spiller_img);
        int position = extras.getInt("position");
        
        spillerprofil.setText(Html.fromHtml(
        		"<br /><br /><br /><b>Navn:</b> <br />" + Truppen_Akt.spillere.get(position).getNavn() +
        		"<br /><br /><b>Trøjenummer:</b> <br /> " + 	Truppen_Akt.spillere.get(position).getTroejenummer() + 
        		"<br /><br /><b>Position: </b> <br />" + Truppen_Akt.spillere.get(position).getPosition() +
        		"<br /><br /><b>Sponsoreret af: </b> <br />" + Truppen_Akt.spillere.get(position).getSponsor()	)	);
        
        spiller_img.setImageResource((Truppen_Akt.getDrawable(this, Truppen_Akt.spillere.get(position).getImage())));
    }
	
	@Override
	public void onClick(View v) {

if(v==imageView1){
            
        	Intent i = new Intent(this, FrontActivity.class);
           
                    startActivity(i);
                    
        }else if(v==gul){
                
                	Intent i = new Intent(this, yellow.class);
                   
                            startActivity(i);
                            
                }else if(v==roed){
                	Intent i = new Intent(this, red.class);
                    
                    		startActivity(i);
                }else if(v==horn){
                	
                	MediaPlayer enLyd = MediaPlayer.create(this, R.raw.vuvuzela);
                    enLyd.setVolume(9, 9);
                    enLyd.start();
        }
                }

}